home *** CD-ROM | disk | FTP | other *** search
/ Totally AMOS / Totally AMOS - Issue 1 (1991-11)(Tucker, Len - Tucker, Anne).adf / source_progs / tutorial1.amos / tutorial1.amosSourceCode
AMOS Source Code  |  1991-10-04  |  8KB  |  262 lines

  1. '***scroll down this list and read all the "'" lines.
  2. '***before you alter anything try running it first to see what it does 
  3. '
  4. '***this turns the cursor off
  5. '
  6. Curs Off 
  7. '
  8. '***this turns flash off, which is colour 3
  9. '
  10. Flash Off 
  11. '
  12. '***this clears the screen, in this case to colour 0, but it could be
  13. '***any number ranging from 0 to the total amount of colours used in 
  14. '***the screen you are working on, in this case 16. so the range would 
  15. '***be 0-15. Try out a few different numbers to see what it does.
  16. '
  17. Cls 0
  18. '
  19. '***this command lets you change the paper colour, in this case ranging
  20. '***from 0-15. Try changing the number . 
  21. '
  22. Paper 0
  23. '
  24. '***you can also change the pen/drawing colour with the command below. 
  25. '***again, change the number used to any number between 0-15.
  26. '***but remember, if you use the same pen & paper colours you will  not
  27. '***see a lot! 
  28. '
  29. Pen 1
  30. '
  31. '***now we ask the user (you!) for his/her name. 
  32. '
  33. '***this command allows you to place the text cursor anywhere on the screen
  34. '***that you want to, the first number is for the X axis, the X range is 
  35. '***between 0 and 39 for this size screen. the second number is for the
  36. '***Y axis. The Y range for this size screen is 0 to 24. Now I will try  
  37. '***and explain X,Y ranges for you. In the box below if you count the
  38. '***amount of "*"'s going across and down, you will see there are 40 
  39. '***for the X axis and 25 for the Y axis, this is because with a lot of
  40. '***commands in basic you start counting from 0 not 1. 
  41. '
  42. '****************************************
  43. '*                                      *
  44. '*&                                     *
  45. '*                                      *
  46. '*                                      *
  47. '*            This is how               *
  48. '*          your screen looks           *
  49. '*       to the 'Locate' command        *
  50. '*                                      *
  51. '*               We used                *
  52. '*              Locate 1,2              *  
  53. '*           so the starting            *
  54. '*       place for our printing         *
  55. '*      Will be where you can see       *
  56. '*           a '&' character            *
  57. '*     If you count across starting     *
  58. '*       from 0, then count down        *  
  59. '*     starting from 0, you should      *
  60. '*       be able to see why the         *
  61. '*         '&' is where it is.          *
  62. '*      Try changing both numbers       *
  63. '*  in the Locate command and see what  *
  64. '*               happens.               *
  65. '*                                      *
  66. '****************************************
  67. '
  68. Locate 1,2
  69. '
  70. '***the input command makes the computer wait for a 'return' or
  71. '***'enter' key to be pressed, until then you can press any other key
  72. '***on the keyboard and the computer (from here on will call the computer
  73. '*** Amy) will put all the characters you press into a string variable,
  74. '***these are like little boxes in Amy's memory where she remembers things 
  75. '***in this case the box is called NAME$, so if you want the information 
  76. '***that Amy put into that box at any time in your program, just work with 
  77. '***the variable(box) called NAME$.
  78. '
  79. Input "What is your name?";NAME$
  80. '
  81. '***here we are changing the print position to goto 2 lines down from the
  82. '***first print. 
  83. '
  84. Locate 1,4
  85. '
  86. '***now change the pen colour to help pretty things up a bit.
  87. '
  88. Pen 4
  89. '
  90. '***this input is slightly different from the one above, this one uses 
  91. '***a different type of variable (box), it is a neumeric variable, 
  92. '***do not worry about its name, the only difference between the 2 types 
  93. '***is the type we used for the name (NAME$, remember?) will remember
  94. '***letters AND numbers, the other one (AGE) will only remember numbers
  95. '***the main reason for the 2 types is with the NAME$ type variable(box) 
  96. '***you cannot perform any mathematical work with it and the AGE 
  97. '***variable (box) you can.
  98. '
  99. Input "How old are you?";AGE
  100. '
  101. '***right, now we can play with the informaion inside the 2 boxes
  102. '***as much as we like!! But first lets tidy up the screen, which
  103. '***by the way is called Screen 0. We do this with a command we have 
  104. '***already used.before I show you the command can you guess which one it is?  
  105. '
  106. '
  107. '
  108. '
  109. '
  110. '
  111. '
  112. '
  113. '
  114. '
  115. '
  116. '
  117. '
  118. '
  119. '
  120. '***the command is cls. Did you guess right? 
  121. '***I think we shall us a different screen colour for this bit 
  122. '***but don't forget if you change the background colour, change the 
  123. '***paper colour 
  124. '
  125. Cls 6
  126. '
  127. '***change the paer colour to match the background.
  128. '
  129. Paper 6
  130. '
  131. '***now change the pen colour to white 
  132. '
  133. Pen 2
  134. '
  135. '***now to use the information inside the boxes NAME$ & AGE
  136. '
  137. '***first use locate to position the printing  
  138. '
  139. Locate 5,2
  140. '
  141. '***Now print something
  142. '
  143. Print "Hello ";NAME$
  144. '
  145. '***move the print position
  146. '
  147. Locate 5,4
  148. '
  149. '***now print about the age
  150. '
  151. Print "Do you like being";AGE
  152. '
  153. '*** move print position again 
  154. '
  155. Locate 5,6
  156. '
  157. '***now print some more
  158. '
  159. Print "I bet you are looking"
  160. '
  161. Locate 5,8
  162. '
  163. '***the line below this does some maths to the box 'AGE' , can you see it? 
  164. '***we are printing what ever is in the box called AGE+1 so if there is  
  165. '***a number 5 in the box it will print 6 (5+1=6)  
  166. '
  167. Print "forward to being";AGE+1
  168. '
  169. '***tell the user what he/she has to do! 
  170. '
  171. Print "Press any key to continue."
  172. '
  173. '***wait key, this command tells Amy to wait until a key has 
  174. '***been pressed before going on.  
  175. '
  176. Wait Key 
  177. '
  178. '***clear the screen again 
  179. Cls 6
  180. '
  181. '***or you could do some thing like this.
  182. '***there are 2 new commands in this bit 'For' and 'Next' these to commands
  183. '***are ALWAYS used together, they are to create a Loop, which means that
  184. '***whatever is inside them must be done Z (or any other variable(box) name) 
  185. '***start the loop by telling Amy to do something 10 times (1-10)  
  186. '
  187. For Z=1 To 10
  188. '***now we use the numbers in locate with a variable so the print position 
  189. '***is different every time the loop  passes the locate
  190. Locate Z,Z
  191. '***the ';' in the print line just tells Amy that you have not 
  192. '***finnished printing on that line yet. 
  193. Print NAME$;" is ";AGE
  194. '
  195. Next Z
  196. '
  197. Print "Press any key to continue."
  198. '
  199. Wait Key 
  200. '***right, thats it for this issue, see how you can change things in this
  201. '***little proggy, the commands we have used so far are:- cls, flash off 
  202. '***curs off, input, locate, paper, pen, For, Next and print.  
  203. '***using just these commands will allow you to create quite a few 
  204. '***interesting programs.
  205. '***when you have finnished playing with the numbers in this listing 
  206. '***either get your mother, father or yourself to delete the 'end' command 
  207. '***below to see what I have done with just the above commands.
  208. '***do not worry about the procedure command yet, we will cover that 
  209. '***in a future issue
  210. End 
  211. EXAMPLE
  212. '***To open this procedure move the cursor to the 'procedure' line 
  213. '***then either press F9 or move the mouse to 'fold/unfold' box at the 
  214. '***top of the screen. 
  215. '***do not worry if you don't understand the example yet, it's just to 
  216. '***show what can be done with the commands covered. 
  217. Procedure EXAMPLE
  218. Shared NAME$,AGE
  219. OLDAGE=AGE
  220. Cls 0
  221. For Z=1 To 11
  222. Locate Z,Z
  223. Pen Z
  224. Paper Z-1
  225. Print NAME$;" is ";AGE
  226. Next Z
  227. For Z=1 To 11
  228. Locate 11-Z,11+Z
  229. Pen Z
  230. Paper Z-1
  231. Print NAME$;" is ";AGE
  232. Next Z
  233. Print "Press a key to continue"
  234. Wait Key 
  235. Paper 0
  236. Pen 2
  237. For TURNS=1 To 3
  238. Pen TURNS
  239. For Y=0 To 23
  240. For X=0 To 20
  241. Wait 1
  242. Locate X,Y
  243. Curs Off 
  244. Print " ";NAME$;" is ";AGE
  245. Next X
  246. Next Y
  247. Add AGE,1
  248. Next TURNS
  249. Print "Press a key to continue"
  250. Wait Key 
  251. For Y=1 To 22
  252. For Z=1 To 22-Y
  253. Locate 2,23-Z
  254. Print "                "
  255. Locate 2,22-Z
  256. Print " ";NAME$;" is ";OLDAGE
  257. Next Z
  258. Next Y
  259. Pen 2
  260. Locate 5,12
  261. Print "Bye bye for this issue"
  262. End Proc